#!/bin/sh
echo "#### CrossCompile START ####"

OUTPUT1="my_ethercat_app1"
OUTPUT2="my_ethercat_app2"

# 删除旧文件
rm -f $OUTPUT1.bin
rm -f $OUTPUT2.bin

# 交叉编译器路径
GCC="/home/zqj/environment/gcc_rk3588/aarch64/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-g++"

# 编译
$GCC -std=c++11 $OUTPUT2.cpp tinyxml2.cpp -o $OUTPUT2.bin \
    -I/usr/local/out_igh/include -L/usr/local/out_igh/lib \
    -lethercat -pthread -lrt

$GCC -std=c++11 $OUTPUT1.cpp pid.cpp filter.cpp tinyxml2.cpp -o $OUTPUT1.bin \
    -I/usr/local/out_igh/include -L/usr/local/out_igh/lib \
    -lethercat -pthread -lrt

# 复制到共享目录
cp -f $OUTPUT2.bin /mnt/hgfs/0VMware_share
cp -f $OUTPUT1.bin /mnt/hgfs/0VMware_share

echo "#### CrossCompile END ####"
